﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.ObjectModel;

namespace Crane.UnitTests.NUnitExtensions
{
    public class TreeConstructionTestInfo
    {
        private string inputData = string.Empty;
        private ReadOnlyCollection<string> expectedErrors = null;
        private string expectedTree = string.Empty;

        public TreeConstructionTestInfo(string data, string expectedErrorList, string expectedTree)
        {
            this.inputData = data;
            this.expectedTree = expectedTree;
            CreateExpectedErrorList(expectedErrorList);
        }

        public string InputData
        {
            get { return inputData; }
        }

        public ReadOnlyCollection<string> ExpectedErrors
        {
            get { return expectedErrors; }
        }

        public string ExpectedTree
        {
            get { return expectedTree; }
        }

        private void CreateExpectedErrorList(string expectedErrorList)
        {
            string[] errorStrings = expectedErrorList.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
            List<string> errorList = new List<string>(errorStrings);
            expectedErrors = errorList.AsReadOnly();
        }
    }
}
